<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
  <head>
    
    <%@ include file="/WEB-INF/include/meta.jsp"%>
    <%@ include file="/WEB-INF/include/css.jsp"%>
    
  </head>
  <body>
    <div class="page-group">
      <div class="page page-current">
        <header class="bar bar-nav fs-header-small">
          <a href="${ctx.host}/credit-coupons" class="icon icon-left pull-left"></a>
          <h1 class="title">兑换记录</h1>
        </header>
        <div class="content">
          <div class="row no-gutter">
          
            <c:forEach items="${coupons}" var="coupon">
              <c:set value="${persist.couponBatch(coupon.batch.id)}" var="couponBatch"></c:set>
              <c:set value="${persist.creditCouponBatch(coupon.batch)}" var="creditCouponBatch"></c:set>
              
                    <div class="col-50 coupon-item">
                      <div class="card ${coupon.status == 'OCCUPIED' or coupon.status == 'USED' or coupon.status == 'OUT_OFF_DATE' ? 'status-change' : ''}">
                        <div class="card-header color-white no-border no-padding" style="vertical-align: bottom;">
                          <img class='card-cover' src="${cloud.prod}/${creditCouponBatch.cover}" alt="">
                        </div>
                        <div class="card-content">
                          <div class="card-content-inner">
                            <p class="coupon-info">${couponBatch.templateName}</p>
                            <p class="color-gray coupon-data text-right">有效期至${coupon.effectiveEndDate}</p>
                          </div>
                        </div>
                      </div>
                      
                      <c:if test="${coupon.status == 'OCCUPIED' or coupon.status == 'USED' or coupon.status == 'OUT_OFF_DATE'}">
                            <div class="fs-m-status status">
                            <span>${coupon.status.description}</span>
                         </div>
                      </c:if>
                   
                    </div>
            
            </c:forEach>
            
          </div>
        </div>
      </div>
    </div>
   
    <%@ include file="/WEB-INF/include/script.jsp"%>
    <d:resource type="script" root="${ctx.resource}/build" src="js/page/credit/coupon-mall.js" />
    <script type="text/javascript">
      require(['page/credit/coupon-mall'], function(page) {
        page.init()
      })
    </script>
  </body>
</html>